<template>
    <section class="jumbotron">
      <h3 class="jumbotron-heading">搜索GitHub用户</h3>
      <div>
        <input type="text" placeholder="输入您搜索的名称" v-model="searchName"/>
        <button @click="search">搜索</button>
      </div>
    </section>
</template>


<script>
import PubSub from 'pubsub-js'
export default {
  data() {
    return {
      searchName:''
    }
  },
  methods: {
    search(){
      const searchName=this.searchName.trim()
      if (searchName) {
        //发布搜索的消息
        PubSub.publish('search',searchName)
      }
    }
  },
}
</script>

<style>

</style>
